package com.wb3.meta.api.core.controller;

import com.wb3.meta.api.core.service.CustomerToysService;
import com.wb3.meta.api.core.vo.ReqCustomerToysVo;
import com.wb3.meta.common.annotation.NoPermission;
import com.wb3.meta.common.annotation.RequireAuth;
import com.wb3.meta.common.plugin.BaseResultController;
import com.wb3.meta.common.pojo.ResultT;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@Api(tags = "商家-崽崽接口")
@RequestMapping("base/customer/toys/")
public class CustomerToysController extends BaseResultController<ReqCustomerToysVo> {

    @Autowired
    private CustomerToysService customerToysService;
    /**
     * 列表接口
     *
     * @param reqCustomerToysVo
     */
    @NoPermission
    @Override
    @ApiOperation("列表接口")
    @GetMapping("list")
    public ResultT list(ReqCustomerToysVo reqCustomerToysVo) {

        return customerToysService.getModelMapPage(reqCustomerToysVo);
    }


    /**
     * 明细接口
     *
     * @param reqCustomerToysVo
     */
    @NoPermission
    @Override
    @ApiOperation("详情接口")
    @GetMapping("detail")
    public ResultT detail(ReqCustomerToysVo reqCustomerToysVo) {
        return customerToysService.getModelMapById(reqCustomerToysVo.getId());
    }

    /**
     * 新增or更新接口
     *
     * @param reqCustomerToysVo
     */
    @NoPermission
    @Override
    @ApiOperation("更新接口")
    @PostMapping("update")
    public ResultT saveOrUpdate(@RequestBody ReqCustomerToysVo reqCustomerToysVo) {
        return customerToysService.saveOrUpdate(reqCustomerToysVo);
    }

    /**
     * 删除接口
     *
     * @param reqCustomerToysVo
     */
    @NoPermission
    @Override
    @ApiOperation("删除接口")
    @PostMapping("delete")
    public ResultT delete(@RequestBody ReqCustomerToysVo reqCustomerToysVo) {
        return customerToysService.delete(reqCustomerToysVo);
    }

    @ApiOperation("创建商家-崽崽")
    @PostMapping("createCToys")
    public ResultT createCToys(@RequestBody ReqCustomerToysVo reqCustomerToysVo) {
        return customerToysService.createCToys(reqCustomerToysVo);
    }

}
